from datetime import datetime
from sqlalchemy import Column, Integer, String, DateTime
from ..infrastructure.database import Base

class FavoritePath(Base):
    __tablename__ = "favorite_paths"

    id = Column(Integer, primary_key=True, autoincrement=True)
    path = Column(String(255), unique=True, nullable=False)
    name = Column(String(100), nullable=False)
    create_time = Column(DateTime, default=datetime.now)

    def to_dict(self):
        """转换为字典格式"""
        return {
            "id": self.id,
            "path": self.path,
            "name": self.name,
            "createTime": self.create_time.timestamp()
        } 